home *** CD-ROM | disk | FTP | other *** search
/ ftp.cs.arizona.edu / ftp.cs.arizona.edu.tar / ftp.cs.arizona.edu / icon / newsgrp / group96a.txt / 000174_icon-group-sender _Wed Aug 7 09:34:22 1996.msg < prev    next >
Internet Message Format  |  1996-09-05  |  2KB

  1. Received: by cheltenham.cs.arizona.edu; Wed, 7 Aug 1996 13:28:39 MST
  2. Date: Wed, 7 Aug 1996 09:34:22 -0500
  3. Message-Id: <199608071434.JAA01511@ns1.computek.net>
  4. Mime-Version: 1.0
  5. Content-Type: text/plain
  6. Content-Transfer-Encoding: 7bit
  7. From: gep2@computek.net
  8. Subject: dos system call
  9. To: icon-group@cs.arizona.edu
  10. X-Mailer: SPRY Mail Version: 04.00.06.17
  11. Errors-To: icon-group-errors@cs.arizona.edu
  12. Status: O
  13.  
  14. >when I include the lines
  15. system("set")       #1
  16. system("set x=y")   #2
  17. system("set")       #3
  18.  in a program, I get the same output from #3 as from #1,
  19.  no additional X=y among the environment variables.
  20.  
  21. >How do I set DOS environment variables from within an Icon program?
  22. I am using MS-DOS 6.21 and Icon 8.10
  23.  
  24. The answer isn't quite "you don't", but it might be, depending on what you want 
  25. to actually do.
  26.  
  27. Each copy of your command interpreter has its own environment variables area, 
  28. and when you launch "system()" you get a new (temporary) copy... and that's the 
  29. copy you're modifying in #2.  When the command interpreter you're running 
  30. terminates, so do the changes you've made to the environment area.  
  31.  
  32. If you need to change the environment variables as needed to run another 
  33. subsequent program using system(), then what you should do is to build a batch 
  34. file which runs SET to change the environment, then runs the target program.  
  35. Note too that if you're running in a DOS shell under Windows, you might not 
  36. actually have ANY available free environment space:  at least some versions of 
  37. Windows collapse the DOS environment to just that actually being used when they 
  38. start a DOS shell.  In that case, you won't be able to add ANYTHING to it, or at 
  39. least not unless you delete something first that you have already there (i.e. 
  40. you can have a "dummy" big item there in the beginning, which you can later 
  41. scrap to give you space for the one(s) you'll be wanting to add later.
  42.  
  43. Hope this helps you.
  44.  
  45. Gordon Peterson
  46. http://www.computek.net/public/gep2/
  47.  
  48.